﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domin;

namespace EF_MySql
{
    public class RMy<T> : IRDomin<T> where T : class
    {
        private readonly SDBCountext db;

        public RMy(SDBCountext db)
        {
            this.db = db;
        }

        public int Add(T model)
        {
            db.Set<T>().Add(model);
            return Ser();
        }

        public int Ser()
        {
            return db.SaveChanges();
        }

        public IQueryable<T> Show()
        {
            return db.Set<T>().AsQueryable();
        }
    }
}
